using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Windows;

public class PlayerMoveState : PlayerState
{
    private int inputX;
    private int inputY;

    public PlayerMoveState(Player player, PlayerStateMachine stateMachine, string animBoolName) : base(player, stateMachine, animBoolName)
    {
    }

    public override void Enter()
    {
        base.Enter();
    }

    public override void Exit()
    {
        base.Exit();
        core.SetVelocity(0, new Vector2(player.Controller.NormInputX, player.Controller.NormInputY));
    }

    public override void LogicUpdate()
    {
        base.LogicUpdate();
        inputX = player.Controller.NormInputX;
        inputY = player.Controller.NormInputY;

        if (player.Controller.AttackInput)
        {
            stateMachine.ChangeState(player.AttackState);
        }

        core.CheckIfShouldFlip(inputX);
        core.SetVelocity(player.Core_.moveSpeed, new Vector2(player.Controller.NormInputX, player.Controller.NormInputY));
        if (inputX == 0 && inputY == 0 && !isExitingState)
        {
            stateMachine.ChangeState(player.IdleState);
        }
    }

    public override void PhysicsUpdate()
    {
        base.PhysicsUpdate();

    }
}
